package com.example.sup.singleton;

/**
 * @ClassName EnumSigletonPattern
 * @Description 枚举方式实现单例：1.防止反序列化  2.防止反射
 * @Author 智邦教育.陈超
 * @Date 5:02 下午 2024/7/31
 * @Version 1.0
 */
public class EnumSingletonPattern {
    public static void main(String[] args) {
        System.out.println(Student3.getInstance().hashCode());
        System.out.println(Student3.getInstance().hashCode());
        System.out.println(Student3.getInstance().hashCode());
    }
}

enum Student3{
    INSTANCE;
    public static Student3 getInstance(){
        return INSTANCE;
    }
}
